﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeGenerator.csharp
{
    public class winformCode : Model.doc
    {
        public winformCode(string content): base(content)
        {
            
        }

        /// <summary>
        /// 表单form代码
        /// </summary>
        /// <returns></returns>
        public string getCsStr()
        {
            var sb = new StringBuilder();
            #region 代码
            sb.Append("using System;\r\n");
            sb.Append("using System.Collections.Generic;\r\n");
            sb.Append("using System.ComponentModel;\r\n");
            sb.Append("using System.Data;\r\n");
            sb.Append("using System.Drawing;\r\n");
            sb.Append("using System.Text;\r\n");
            sb.Append("using System.Windows.Forms;\r\n");
            sb.Append("\r\n");
            sb.Append("namespace "+toTitle(headName)+" \r\n");
            sb.Append("{\r\n");
            sb.Append("    public partial class frm" + toTitle(headName) + "View : Form\r\n");
            sb.Append("    {\r\n");
            sb.Append("        public frm" + toTitle(headName) + "View()\r\n");
            sb.Append("        {\r\n");
            sb.Append("            InitializeComponent();\r\n");
            sb.Append("        }\r\n");
            sb.Append("        BZZ.Model." + headName + "  m" + toTitle(headName) + " = new BZZ.Model." + headName + "();\r\n");
            sb.Append("        private void frm" + toTitle(headName) + "View_Load(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");

            sb.Append("            string sid = lblID.Text;\r\n");
            sb.Append("            this.Text = \"更新记录\"+sid;\r\n");
            sb.Append("            int id = int.Parse(sid);\r\n");
            sb.Append("            m" + toTitle(headName) + " = m" + toTitle(headName) + ".GetModel(id);\r\n");
            for (int i = 1; i < fieldNum; i++)
            {
                sb.Append("            txt" + toTitle(fnames[i]) + ".Text = m" + toTitle(headName) + "." + fnames[i] + ".ToString();\r\n");
            }
            sb.Append("\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnSave_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("\r\n");
            sb.Append("            m"+toTitle(headName)+".id = int.Parse(lblID.Text);\r\n");
            sb.Append("            m" + toTitle(headName) + " = m" + toTitle(headName) + ".GetModel(m" + toTitle(headName) + ".id);\r\n");
            
            for (int i = 1; i < fieldNum; i++)
            {
                string fty = tyProgram[i];
                if (fty == "string")
                {
                    sb.Append("            m" + toTitle(headName) + "." + fnames[i] + " = txt" + toTitle(fnames[i]) + ".Text;\r\n");
                }
                else
                {
                    sb.Append("            m" + toTitle(headName) + "." + fnames[i] + " = Convert.To"+fty+"(txt" + toTitle(fnames[i]) + ".Text);\r\n");
                }
            }
            sb.Append("            m"+toTitle(headName)+".Update();\r\n");
            sb.Append("            MessageBox.Show(\"保存成功\");\r\n");
            sb.Append("            this.Close();\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnClose_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            this.Close();\r\n");
            sb.Append("        }\r\n");
            sb.Append("    }\r\n");
            sb.Append("}\r\n");
            sb.Append("\r\n");

            #endregion

            return sb.ToString();
         }

        /// <summary>
        /// 表单设计代码
        /// </summary>
        /// <returns></returns>
        public string getCsDesignerStr()
        {
            var sb = new StringBuilder();
            #region 代码
            sb.Append("namespace " + toTitle(headName) + "\r\n");
            //sb.Append("namespace "+toTitle(headName)+"\r\n");
            sb.Append("{\r\n");
            sb.Append("    partial class frm" + toTitle(headName) + "View\r\n");
            sb.Append("    {\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// Required designer variable.\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        private System.ComponentModel.IContainer components = null;\r\n");
            sb.Append("\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// Clean up any resources being used.\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\r\n");
            sb.Append("        protected override void Dispose(bool disposing)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            if (disposing && (components != null))\r\n");
            sb.Append("            {\r\n");
            sb.Append("                components.Dispose();\r\n");
            sb.Append("            }\r\n");
            sb.Append("            base.Dispose(disposing);\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        #region Windows Form Designer generated code\r\n");
            sb.Append("\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// Required method for Designer support - do not modify\r\n");
            sb.Append("        /// the contents of this method with the code editor.\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        private void InitializeComponent()\r\n");
            sb.Append("        {\r\n");
            sb.Append("            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm"+toTitle(headName)+"View));\r\n");
            for (int i = 1; i < fieldNum; i++)
            {
                sb.Append("            this.txt"+toTitle(fnames[i])+" = new System.Windows.Forms.TextBox();\r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + " = new System.Windows.Forms.Label();\r\n");
            }
            sb.Append("            this.btnSave = new System.Windows.Forms.Button();\r\n");
            sb.Append("            this.btnClose = new System.Windows.Forms.Button();\r\n");
            
            sb.Append("            this.lblID = new System.Windows.Forms.Label();\r\n");
            sb.Append("            this.SuspendLayout();\r\n");
            int pLeft = 100;
            int pTop = 30;
            int rowHeight = 25;
            
            for (int i = 1; i < fieldNum; i++)
            {
                sb.Append("            // \r\n");
                sb.Append("            // txt" + toTitle(fnames[i]) + "\r\n");
                sb.Append("            // \r\n");
                sb.Append("            this.txt" + toTitle(fnames[i]) + ".Location = new System.Drawing.Point(" + pLeft.ToString() + ", " + (pTop + i * rowHeight).ToString() + ");\r\n");
                sb.Append("            this.txt" + toTitle(fnames[i]) + ".Name = \"txt" + toTitle(fnames[i]) + "\";\r\n");
                sb.Append("            this.txt" + toTitle(fnames[i]) + ".Size = new System.Drawing.Size(200, 20);\r\n");
                sb.Append("            this.txt" + toTitle(fnames[i]) + ".TabIndex = "+ (i*2-1).ToString()+" ;\r\n");

                sb.Append("            // \r\n");
                sb.Append("            // lblDomain\r\n");
                sb.Append("            // \r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + ".Location = new System.Drawing.Point(" + (pLeft - 80).ToString() + ", " + (pTop + i * rowHeight).ToString() + ");\r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + ".Name = \"lblDomain\";\r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + ".Size = new System.Drawing.Size(80, 20);\r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + ".TabIndex = " + (i * 2 ).ToString() + ";\r\n");
                sb.Append("            this.lbl" + toTitle(fnames[i]) + ".Text = \""+txts[i]+"：\";\r\n");
            }
            int btnSaveLeft = pLeft ;
            int btnSaveTop = pTop + fieldNum * rowHeight;

            sb.Append("            // \r\n");
            sb.Append("            // btnSave\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.btnSave.Location = new System.Drawing.Point("+btnSaveLeft.ToString()+", "+btnSaveTop.ToString()+" );\r\n");
            sb.Append("            this.btnSave.Name = \"btnSave\";\r\n");
            sb.Append("            this.btnSave.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.btnSave.TabIndex = 4;\r\n");
            sb.Append("            this.btnSave.Text = \"保存\";\r\n");
            sb.Append("            this.btnSave.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // button1\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.btnClose.Location = new System.Drawing.Point(" + (btnSaveLeft+150).ToString() + ", " + btnSaveTop.ToString() + ");\r\n");
            sb.Append("            this.btnClose.Name = \"button1\";\r\n");
            sb.Append("            this.btnClose.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.btnClose.TabIndex = 5;\r\n");
            sb.Append("            this.btnClose.Text = \"退出\";\r\n");
            sb.Append("            this.btnClose.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // lblID\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.lblID.AutoSize = true;\r\n");
            sb.Append("            this.lblID.Location = new System.Drawing.Point(238, 13);\r\n");
            sb.Append("            this.lblID.Name = \"lblID\";\r\n");
            sb.Append("            this.lblID.Size = new System.Drawing.Size(35, 12);\r\n");
            sb.Append("            this.lblID.TabIndex = 6;\r\n");
            sb.Append("            this.lblID.Text = \"11232\";\r\n");
            sb.Append("            this.lblID.Visible = false;\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // frmView\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r\n");
            sb.Append("            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n");
            sb.Append("            this.ClientSize = new System.Drawing.Size(400, "+(btnSaveTop+50).ToString()+");\r\n");
            sb.Append("            this.Controls.Add(this.lblID);\r\n");
            for (int i = 1; i < fieldNum; i++)
            {
                sb.Append("            this.Controls.Add(this.txt"+toTitle(fnames[i])+");\r\n");
                sb.Append("            this.Controls.Add(this.lbl" + toTitle(fnames[i]) + ");\r\n");
            }
            sb.Append("            this.Controls.Add(this.btnSave);\r\n");
            sb.Append("            this.Controls.Add(this.btnClose);\r\n");
            sb.Append("            this.Icon = ((System.Drawing.Icon)(resources.GetObject(\"$this.Icon\")));\r\n");
            sb.Append("            this.MaximizeBox = false;\r\n");
            sb.Append("            this.MinimizeBox = false;\r\n");
            sb.Append("            this.Name = \"frm" + toTitle(headName) + "View\";\r\n");
            sb.Append("            this.Text = \"frm" + toTitle(headName) + "View\";\r\n");
            sb.Append("            this.Load += new System.EventHandler(this.frm" + toTitle(headName) + "View_Load);\r\n");
            sb.Append("            this.ResumeLayout(false);\r\n");
            sb.Append("            this.PerformLayout();\r\n");
            sb.Append("\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        #endregion\r\n");
            sb.Append("\r\n");
            for (int i = 1; i < fieldNum; i++)
            {
                sb.Append("        private System.Windows.Forms.TextBox txt" + toTitle(fnames[i]) + ";\r\n");
                sb.Append("        private System.Windows.Forms.Label lbl" + toTitle(fnames[i]) + ";\r\n");
            }
            sb.Append("\r\n");
            sb.Append("        private System.Windows.Forms.Button btnClose;\r\n");
            sb.Append("        private System.Windows.Forms.Button btnSave;\r\n");
            sb.Append("        public System.Windows.Forms.Label lblID;\r\n");
            sb.Append("    }\r\n");
            sb.Append("}\r\n");

            #endregion

            return sb.ToString();
         }

        /// <summary>
        /// 列表form代码
        /// </summary>
        /// <returns></returns>
        public string getListCsStr()
        {
            var sb = new StringBuilder();
            #region 代码
            sb.Append("using System;\r\n");
            sb.Append("using System.Collections.Generic;\r\n");
            sb.Append("using System.ComponentModel;\r\n");
            sb.Append("using System.Data;\r\n");
            sb.Append("using System.Drawing;\r\n");
            sb.Append("using System.Text;\r\n");
            sb.Append("using System.Windows.Forms;\r\n");
            sb.Append("\r\n");
            sb.Append("namespace " + toTitle(headName) + "\r\n");
            sb.Append("{\r\n");
            sb.Append("    public partial class frm" + toTitle(headName) + " : Form\r\n");
            sb.Append("    {\r\n");
            sb.Append("        BZZ.Model." + headName + " m" + toTitle(headName) + " = new BZZ.Model." + headName + "();\r\n");
            sb.Append("        public frm" + toTitle(headName) + "()\r\n");
            sb.Append("        {\r\n");
            sb.Append("            InitializeComponent();\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void bntLoadData_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            //bindData();\r\n");
            sb.Append("            \r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// 把数据绑定到gridview\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        private void bindData()\r\n");
            sb.Append("        {\r\n");
            sb.Append("            string fieldList = \""+fnameList+" \";\r\n");
            sb.Append("            DataSet dset = m" + toTitle(headName) + ".GetDataset(null, fieldList,\"days\",\"asc\");\r\n");
            sb.Append("            DataTable dt = dset.Tables[0];\r\n");
            for (int i = 0; i < fieldNum; i++)
            {
                sb.Append("            //dt.Columns[\""+fnames[i]+"\"].ColumnName = \""+txts[i]+"\";\r\n");
            }
            sb.Append("            txtMsg.Text = dset.Tables[0].Rows.Count.ToString();\r\n");
            sb.Append("            dgv" + toTitle(headName) + "list.DataSource = dt;\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void frm" + toTitle(headName) + "_Load(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            bindData();\r\n");
            sb.Append("            if (dgv" + toTitle(headName) + "list.Columns.Contains(\"id\"))\r\n");
            sb.Append("            {\r\n");
            sb.Append("                dgv" + toTitle(headName) + "list.Columns[\"id\"].Visible = false;\r\n");
            sb.Append("            }\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnClose_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            Application.Exit();\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnSave_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            string s = dgv" + toTitle(headName) + "list.CurrentRow.Cells[0].Value.ToString();\r\n");
            sb.Append("            MessageBox.Show(s);\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnEdit_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            var f = new " + toTitle(headName) + ".frm" + toTitle(headName) + "View();\r\n");
            sb.Append("            f.lblID.Text = dgv" + toTitle(headName) + "list.CurrentRow.Cells[0].Value.ToString();\r\n");
            sb.Append("            \r\n");
            sb.Append("            f.Show();\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        private void btnReloadData_Click(object sender, EventArgs e)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            bindData();\r\n");
            sb.Append("        }\r\n");
            sb.Append("    }\r\n");
            sb.Append("}\r\n");
            sb.Append("\r\n");

            #endregion

            return sb.ToString();
         }


        /// <summary>
        /// 表单设计代码
        /// </summary>
        /// <returns></returns>
        public string getCsDesignerStr2()
        {
            var sb = new StringBuilder();
            #region 代码

            sb.Append("namespace "+toTitle(headName)+"\r\n");
            sb.Append("{\r\n");
            sb.Append("    partial class frm"+toTitle(headName)+"\r\n");
            sb.Append("    {\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// 必需的设计器变量。\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        private System.ComponentModel.IContainer components = null;\r\n");
            sb.Append("\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// 清理所有正在使用的资源。\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        /// <param name=\"disposing\">如果应释放托管资源，为 true；否则为 false。</param>\r\n");
            sb.Append("        protected override void Dispose(bool disposing)\r\n");
            sb.Append("        {\r\n");
            sb.Append("            if (disposing && (components != null))\r\n");
            sb.Append("            {\r\n");
            sb.Append("                components.Dispose();\r\n");
            sb.Append("            }\r\n");
            sb.Append("            base.Dispose(disposing);\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        #region Windows 窗体设计器生成的代码\r\n");
            sb.Append("\r\n");
            sb.Append("        /// <summary>\r\n");
            sb.Append("        /// 设计器支持所需的方法 - 不要\r\n");
            sb.Append("        /// 使用代码编辑器修改此方法的内容。\r\n");
            sb.Append("        /// </summary>\r\n");
            sb.Append("        private void InitializeComponent()\r\n");
            sb.Append("        {\r\n");
            sb.Append("            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm" + toTitle(headName) + "));\r\n");
            sb.Append("            this.dgv" + toTitle(headName) + "list = new System.Windows.Forms.DataGridView();\r\n");
            sb.Append("            this.bntLoadData = new System.Windows.Forms.Button();\r\n");
            sb.Append("            this.txtMsg = new System.Windows.Forms.TextBox();\r\n");
            sb.Append("            this.button1 = new System.Windows.Forms.Button();\r\n");
            sb.Append("            this.btnSave = new System.Windows.Forms.Button();\r\n");
            sb.Append("            this.btnEdit = new System.Windows.Forms.Button();\r\n");
            sb.Append("            this.btnReloadData = new System.Windows.Forms.Button();\r\n");
            sb.Append("            ((System.ComponentModel.ISupportInitialize)(this.dgv" + toTitle(headName) + "list)).BeginInit();\r\n");
            sb.Append("            this.SuspendLayout();\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // dgv" + toTitle(headName) + "list\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.Location = new System.Drawing.Point(12, 13);\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.Name = \"dgv"+toTitle(headName)+"list\";\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.ReadOnly = true;\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.RowTemplate.Height = 23;\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.Size = new System.Drawing.Size(659, 449);\r\n");
            sb.Append("            this.dgv"+toTitle(headName)+"list.TabIndex = 0;\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // bntLoadData\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.bntLoadData.Location = new System.Drawing.Point(213, 479);\r\n");
            sb.Append("            this.bntLoadData.Name = \"bntLoadData\";\r\n");
            sb.Append("            this.bntLoadData.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.bntLoadData.TabIndex = 1;\r\n");
            sb.Append("            this.bntLoadData.Text = \"加载\";\r\n");
            sb.Append("            this.bntLoadData.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.bntLoadData.Visible = false;\r\n");
            sb.Append("            this.bntLoadData.Click += new System.EventHandler(this.bntLoadData_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // txtMsg\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.txtMsg.Location = new System.Drawing.Point(91, 481);\r\n");
            sb.Append("            this.txtMsg.Name = \"txtMsg\";\r\n");
            sb.Append("            this.txtMsg.Size = new System.Drawing.Size(100, 21);\r\n");
            sb.Append("            this.txtMsg.TabIndex = 2;\r\n");
            sb.Append("            this.txtMsg.Visible = false;\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // button1\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.button1.Location = new System.Drawing.Point(602, 481);\r\n");
            sb.Append("            this.button1.Name = \"button1\";\r\n");
            sb.Append("            this.button1.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.button1.TabIndex = 3;\r\n");
            sb.Append("            this.button1.Text = \"退出\";\r\n");
            sb.Append("            this.button1.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.button1.Click += new System.EventHandler(this.button1_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // btnSave\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.btnSave.Location = new System.Drawing.Point(294, 481);\r\n");
            sb.Append("            this.btnSave.Name = \"btnSave\";\r\n");
            sb.Append("            this.btnSave.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.btnSave.TabIndex = 4;\r\n");
            sb.Append("            this.btnSave.Text = \"保存\";\r\n");
            sb.Append("            this.btnSave.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.btnSave.Visible = false;\r\n");
            sb.Append("            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // btnEdit\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.btnEdit.Location = new System.Drawing.Point(507, 481);\r\n");
            sb.Append("            this.btnEdit.Name = \"btnEdit\";\r\n");
            sb.Append("            this.btnEdit.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.btnEdit.TabIndex = 5;\r\n");
            sb.Append("            this.btnEdit.Text = \"编辑\";\r\n");
            sb.Append("            this.btnEdit.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // btnReloadData\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.btnReloadData.Location = new System.Drawing.Point(413, 481);\r\n");
            sb.Append("            this.btnReloadData.Name = \"btnReloadData\";\r\n");
            sb.Append("            this.btnReloadData.Size = new System.Drawing.Size(75, 23);\r\n");
            sb.Append("            this.btnReloadData.TabIndex = 6;\r\n");
            sb.Append("            this.btnReloadData.Text = \"刷新\";\r\n");
            sb.Append("            this.btnReloadData.UseVisualStyleBackColor = true;\r\n");
            sb.Append("            this.btnReloadData.Click += new System.EventHandler(this.btnReloadData_Click);\r\n");
            sb.Append("            // \r\n");
            sb.Append("            // frm"+toTitle(headName)+"\r\n");
            sb.Append("            // \r\n");
            sb.Append("            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r\n");
            sb.Append("            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n");
            sb.Append("            this.ClientSize = new System.Drawing.Size(689, 525);\r\n");
            sb.Append("            this.Controls.Add(this.btnReloadData);\r\n");
            sb.Append("            this.Controls.Add(this.btnEdit);\r\n");
            sb.Append("            this.Controls.Add(this.btnSave);\r\n");
            sb.Append("            this.Controls.Add(this.button1);\r\n");
            sb.Append("            this.Controls.Add(this.txtMsg);\r\n");
            sb.Append("            this.Controls.Add(this.bntLoadData);\r\n");
            sb.Append("            this.Controls.Add(this.dgv"+toTitle(headName)+"list);\r\n");
            sb.Append("            this.Icon = ((System.Drawing.Icon)(resources.GetObject(\"$this.Icon\")));\r\n");
            sb.Append("            this.MaximizeBox = false;\r\n");
            sb.Append("            this.Name = \"frm"+toTitle(headName)+"\";\r\n");
            sb.Append("            this.Text = \"域名到期提醒程序\";\r\n");
            sb.Append("            this.Load += new System.EventHandler(this.frm"+toTitle(headName)+"_Load);\r\n");
            sb.Append("            ((System.ComponentModel.ISupportInitialize)(this.dgv"+toTitle(headName)+"list)).EndInit();\r\n");
            sb.Append("            this.ResumeLayout(false);\r\n");
            sb.Append("            this.PerformLayout();\r\n");
            sb.Append("\r\n");
            sb.Append("        }\r\n");
            sb.Append("\r\n");
            sb.Append("        #endregion\r\n");
            sb.Append("\r\n");
            sb.Append("        private System.Windows.Forms.DataGridView dgv"+toTitle(headName)+"list;\r\n");
            sb.Append("        private System.Windows.Forms.Button bntLoadData;\r\n");
            sb.Append("        private System.Windows.Forms.TextBox txtMsg;\r\n");
            sb.Append("        private System.Windows.Forms.Button button1;\r\n");
            sb.Append("        private System.Windows.Forms.Button btnSave;\r\n");
            sb.Append("        private System.Windows.Forms.Button btnEdit;\r\n");
            sb.Append("        private System.Windows.Forms.Button btnReloadData;\r\n");
            sb.Append("    }\r\n");
            sb.Append("}\r\n");
            sb.Append("\r\n");
            #endregion

            return sb.ToString();
        }


   }
}
